Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve test coverage #310

Merged

Conversation

phackstock
Copy link
Contributor

@phackstock phackstock commented Jan 18, 2024

Closes #309.

Changes implemented

Added tests

  • Improved test coverage to:
Module statements missing excluded coverage
nomenclature/init.py 27 2 0 93%
nomenclature/countries.py 35 2 0 94%
nomenclature/codelist.py 261 7 0 97%
nomenclature/processor/region.py 305 8 0 97%
nomenclature/processor/required_data.py 119 3 0 97%
nomenclature/testing.py 62 2 0 97%
nomenclature/validation.py 35 1 0 97%
nomenclature/config.py 86 2 0 98%
nomenclature/definition.py 52 1 0 98%
nomenclature/code.py 109 1 0 99%
nomenclature/cli.py 34 0 0 100%
nomenclature/core.py 22 0 0 100%
nomenclature/error.py 15 0 0 100%
nomenclature/processor/init.py 3 0 0 100%
nomenclature/processor/meta.py 21 0 0 100%
nomenclature/processor/processor.py 6 0 0 100%
nomenclature/processor/utils.py 3 0 0 100%
tests/conftest.py 32 0 0 100%
tests/test_check_aggregate.py 26 0 0 100%
tests/test_cli.py 93 0 0 100%
tests/test_code.py 49 0 0 100%
tests/test_codelist.py 124 0 0 100%
tests/test_config.py 13 0 0 100%
tests/test_core.py 93 0 0 100%
tests/test_countries.py 14 0 0 100%
tests/test_definition.py 49 0 0 100%
tests/test_definition_variable.py 13 0 0 100%
tests/test_meta.py 24 0 0 100%
tests/test_model_registration_parser.py 14 0 0 100%
tests/test_region_aggregation.py 76 0 0 100%
tests/test_required_data.py 36 0 0 100%
tests/test_testing.py 24 0 0 100%
tests/test_validation.py 36 0 0 100%
Total 1911 29 0 98%

the remaining few percent I deemed either not necessary to test or point to potentially unused code which I didn't want to touch for this PR.

parse_model_registration

  • Cleaned up the docstring and added an option to set a target directory for the generated model mapping and region list.
  • Added a test.

Aligned CLI with standards

  • Changed the list option from --dimensions [one, two] to --dimensions one --dimensions two. This is now in line with cli standards.

Made the setitem method of CodeList more robust

  • Added checks if the item added is of type Code and if the key and the code name are identical
  • Added tests

Clean up config

  • Removed unnecessary code from NomenclatureConfig.
  • Force validation of local_path
  • Added tests

@phackstock phackstock self-assigned this Jan 18, 2024
Copy link
Member

@danielhuppmann danielhuppmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor suggestion in the docstring, otherwise good to go - and nice work!

nomenclature/__init__.py Outdated Show resolved Hide resolved
Co-authored-by: Daniel Huppmann <dh@dergelbesalon.at>
@phackstock phackstock merged commit a9c47dc into IAMconsortium:main Jan 22, 2024
8 checks passed
@phackstock phackstock deleted the feature/improve-test-coverage branch January 22, 2024 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve test coverage
2 participants